package com.woniuxy.qiantai.mapper;

import com.woniuxy.qiantai.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author firstGroup
 * @since 2023-02-22 09:45:58
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    @Select("SELECT COUNT(1)\n" +
            "FROM t_order\n" +
            "WHERE shop_id=#{shopId} and `status` = 6 or `status` = 7\n")
    int countOrder(@Param("shopId")Integer shopId);
    @Select("SELECT AVG(sum_price)\n" +
            "FROM t_order\n" +
            "WHERE shop_id=#{shopId} and `status` = 6 or `status` = 7\n")
    int perCost(@Param("shopId")Integer shopId);
}
